<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>dom的基本操作</title>
		<style>
			.mystyle{
				width: 600px;
				min-height: 120px;
				margin-top: 10px;
				background-color: #cccccc ;
				padding:5px;
			}
			button{
				width: 120px;
				height: 40px;
			}
		</style>
	</head>
	<body>
		 <div class="mystyle"></div>
		 <div class="mystyle"></div>
		
		 <button id="btn01">append</button>
		 <button id="btn02">prepend</button>
		 <button id="btn03">before</button>
		 <button id="btn04">repalceWith</button>
		 <button id="btn05">wrap</button>
		 <button id="btn06">wrapAll</button>
		 
		 <div id="d01" class="mystyle">
			 <p>child-1</p>
			 <p>child-2</p>
			 <p>child-3</p>
			 <p>child-4</p>
			<span>span-1</span>
			<span>span-2</span>
			<span>span-3</span>
			<span>span-4</span>
		 </div>
		 <button id="btn07">children</button>
		<script src="./js/jQuery/jquery-3.4.1.js"></script>
		<script>
		 $(function(){
			$("#btn01").click(function(){
				$(".mystyle").append("<p>"+new Date()+"</p>");
			}); 
			
			$("#btn02").click(function(){
				$(".mystyle").prepend("<p><strong>"+new Date()+"</strong></p>");
			}); 
			$("#btn03").click(function(){
				$(".mystyle").before("<h6>Before---</h6>");
			}); 
			
			$("#btn04").click(function(){
				$(".mystyle p").replaceWith("<a href='#'>"+new Date()+"</a><br>");
			}); 
			
			$("#btn05").click(function(){
				$(".mystyle p").wrap("<div></div>");
			}); 
			$("#btn06").click(function(){
				$(".mystyle p").wrapAll("<div></div>");
			});
			$("#btn07").click(function(){
				var childs=$("#d01").children();
				console.log(childs);
				var spans=$("#d01").children("span");
				console.log(spans);
				
			});
		 }); 
	    </script>
	</body>
</html>
